import java.util.Scanner;

/**
 * Created with IDEA
 * author:ju bai
 * Date:2021/4/29
 * Time:15:48
 **/
public class Main1 {
    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            int count = 0;
            for (int i = 1; i <= n; i++) {//i从1开始
                boolean flag = perfectNum(i);
                if (flag) {
                    count++;
                }
            }
            System.out.println(count);
        }
    }

    /**
     * 每日一题-完全数计算
     *
     * @param num 从1~num 的数
     * @return 返回是否满足和等于他本身
     */

    public static boolean perfectNum(int num) {
        int sum = 0;
        for (int i = 1; i < num; i++) {//i从1开始
            if (num % i == 0) {//判断约数
                sum += i;
            }
        }
        return sum == num;//如果和等于这个数那么返回true
    }


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            int count = 0;
            for (int i = 2; i <= n; i++) {//i从2开始
                int sum = 0;
                for (int j = 2; j * j <= i; j++) {
                    if (i % j == 0) {
                        if (i / j == j) {
                            sum += j;
                        } else {
                            sum = sum + j + i / j;
                        }
                    }
                }
                if (sum + 1 == i) {
                    count++;
                }
            }
            System.out.println(count);
        }
    }
}